<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    
    <ui:composition template="/template.xhtml">
        
        <ui:define name="title">
            <h:outputText value="#{bundle.ListCountryTitle}"></h:outputText>
        </ui:define>
        
        <ui:define name="body">
            
            <!-- start of the login form -->
            
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateCountryLabel_countryName}" for="countryName" />
                    <h:inputText id="countryName" value="#{countryController.selected.countryName}" title="#{bundle.CreateCountryTitle_countryName}" required="true" requiredMessage="#{bundle.CreateCountryRequiredMessage_countryName}"/>
                </h:panelGrid>
                
                <div class="clear"></div>
                <center>
                    <h:commandButton value="اضافه" action="#{countryController.create}" styleClass="btn btn-primary" />
                </center>
            </h:form>
            
            <h:form styleClass="well form-inline">
                
                <h:outputText escape="false" value="#{bundle.ListCountryEmpty}" rendered="#{countryController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{countryController.items.rowCount > 0}">
                    
                    <p:dataTable value="#{countryController.items}" var="item"
                                 paginator="true" rows="10"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="10,20,30"
                                 >
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCountryTitle_countryName}"/>
                            </f:facet>
                            <h:outputText value="#{item.countryName}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandButton action="#{countryController.prepareView}" value="#{bundle.ListCountryViewLink}" styleClass="btn btn-primary"/>
                            <h:outputText value=" "/>
                            <h:commandButton action="#{countryController.prepareEdit}" value="#{bundle.ListCountryEditLink}" styleClass="btn btn-primary"/>
                            <h:outputText value=" "/>
                            <h:commandButton action="#{countryController.destroy}" value="#{bundle.ListCountryDestroyLink}" styleClass="btn btn-primary"/>
                        </p:column>
                    </p:dataTable>
                </h:panelGroup>
                <br />
            </h:form>
        </ui:define>
    </ui:composition>
</html>
